package com.cmcc.pp.ui.platformmonitoring;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.cmcc.pp.R;
import com.cmcc.pp.base.BActivity;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by ABC on 2018/1/2.
 * 拨测结果
 */

public class ResultForServiceDialingActivity extends BActivity {

    @Bind(R.id.relat_step)
    RelativeLayout relatStep;
    @Bind(R.id.tv_result)
    TextView tvResult;


    @Override
    protected boolean getHasTitle() {
        return true;
    }

    @Override
    public int getContentLayoutId() {
        return R.layout.avtivity_resultforservicedialing;
    }

    @Override
    public void initView(Bundle savedInstanceState) {
        getHeader().setTitle(R.string.servicedialing);

        relatStep.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(ResultForServiceDialingActivity.this, StepDetailsActivity.class);
                startActivity(intent);
            }
        });
    }

    @Override
    public void loadData() {

    }

    @OnClick({
            R.id.tv_result,
    })
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.tv_result:
                showGiveupDailog();
                break;
        }
    }

    //是否放弃拨测提示
    private void showGiveupDailog() {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        final AlertDialog dialog = builder.create();
        View view = View.inflate(this, R.layout.dailog_giveupservicedialing, null);
        dialog.setView(view, 0, 0, 0, 0);

        TextView tvCancel = view.findViewById(R.id.dailog_tv_cancel);
        TextView tvSure = view.findViewById(R.id.dailog_tv_sure);


        tvCancel.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                dialog.dismiss();// 隐藏dialog
            }
        });

        dialog.show();


    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }
}
